<?php
$numcount = mysql_query("SELECT term_data.name AS name,term_data.name AS name,term_data.description AS description,term_data.tid AS tid,
   term_data.vid AS vid,term_hierarchy.parent as parent 
 FROM term_data term_data 
 LEFT JOIN term_hierarchy term_hierarchy ON term_data.tid = term_hierarchy.tid
 WHERE parent='".$_REQUEST['id']."'");
 
 $count = mysql_num_rows($numcount);
  $per_page = 2;
	 
     $pages = ceil($count/$per_page);
     $page = $_REQUEST['page'];     
	 $Prev_Page = $page-1;
     $Next_Page = $page+1;
     if($count<=$per_page)
{
	$Num_Pages =1;
}
else if(($count % $per_page)==0)
{
	$Num_Pages =($count/$per_page) ;
}
else
{
	$Num_Pages =($count/$per_page)+1;
	$Num_Pages = (int)$Num_Pages;
}
     $start = ($page-1)*5;
 
if($start > 0 )
{
$query3 = "SELECT term_data.name AS name,term_data.name AS name,term_data.description AS description,term_data.tid AS tid,
   term_data.vid AS vid,term_hierarchy.parent as parent 
 FROM term_data term_data 
 LEFT JOIN term_hierarchy term_hierarchy ON term_data.tid = term_hierarchy.tid
 WHERE parent='".$quesid."' limit ".$start.",2";
$result3 = mysql_query($query3);
}



echo "<li><a href='#'>".$data2->name."</a><div class='acitem'>
                            	<div class='left_area_image' style='margin-right:10px;'><img src='file:///C|/Documents and Settings/Admin/Desktop/images/icon3.png' width='72' height='73' /></div>
                                <div class='right_area_content'>";


while($data3 = mysql_fetch_array($result3))
{


echo "<h7><a href='file:///C|/Documents and Settings/Admin/Desktop/tests/lists/".$data3->tid."'>".$data3->name."</a></h7>
                                    <p>".$data3->description."</p>
                                    <p class='details'><span class='right'>details</span></p>";
                                    
                                    
                                   
     
	$per_page = 2;
	 $page=1;
	  $pages = ceil($count/$per_page);
	  $page = $_REQUEST['img_id'];     
	 $Prev_Page = $page-1;
     $Next_Page = $page+1;
     if($count<=$per_page)
{
	$Num_Pages =1;
}
else if(($count % $per_page)==0)
{
	$Num_Pages =($count/$per_page) ;
}
else
{
	$Num_Pages =($count/$per_page)+1;
	$Num_Pages = (int)$Num_Pages;
}
     
if($Prev_Page) 
{
	echo "<a href='javascript:void(0)' onclick='fetchPage(".$Prev_Page.",".$quesid.")'> Back </a> ";
}

if($page!=$Num_Pages)
{
	echo "<a href='javascript:void(0)' onclick='fetchPage(".$Next_Page.",".$quesid.")'>Next</a> ";
}
                      


}
echo "</div></div>";

echo "</li>";

?>
